package com.thoughtworks.impersonator.http.replay;

import static org.hamcrest.CoreMatchers.notNullValue;
import static org.junit.Assert.assertThat;

import org.jboss.netty.channel.ChannelPipeline;
import org.jboss.netty.handler.codec.http.HttpChunkAggregator;
import org.junit.Test;
import org.mockito.Mockito;

import com.thoughtworks.impersonator.http.message.storage.HttpExchangeStorage;

public class ImpersonatorPipelineFactoryTest {

    @Test
    public void shouldRegisterChunkedHttpDecoder() throws Exception {
        ImpersonatorPipelineFactory factory = new ImpersonatorPipelineFactory(Mockito.mock(HttpExchangeStorage.class));
        
        ChannelPipeline pipeline = factory.getPipeline();
        
        assertThat(pipeline.get(HttpChunkAggregator.class), notNullValue());
    }
    
    @Test
    public void shouldRegisterImpersonatorHandler() throws Exception {
        ImpersonatorPipelineFactory factory = new ImpersonatorPipelineFactory(Mockito.mock(HttpExchangeStorage.class));
        
        ChannelPipeline pipeline = factory.getPipeline();
        
        assertThat(pipeline.get(ImpersonatorHandler.class), notNullValue());
    }
}
